package com.appspot.didit.client;

import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import com.google.gwt.benchmarks.client.Benchmark;
import com.google.gwt.benchmarks.client.IntRange;
import com.google.gwt.benchmarks.client.Operator;
import com.google.gwt.benchmarks.client.RangeField;

public class DiditBenchmark extends Benchmark {

	  final IntRange baseRange = new IntRange(512, Integer.MAX_VALUE,
	      Operator.MULTIPLY, 2);
	  private ArrayList testVector = new Vector();
	  private ArrayList testList = new ArrayList();
	  
	  /**
	   * Must refer to a valid module that sources this class.
	   */
	  public String getModuleName() {
	    return "com.appspot.didit.Didit";
	  }

	  /**
	   * JUnit requires a method that takes no arguments.  It is not used for 
	   * Benchmarking.
	   */
	  public void testSimpleVector() {
	  }
	  
	  /**
	   * Test adding an element to a vector 
	   */
	  public void testSimpleVector(@RangeField("baseRange") Integer size)
	  {
	    int len = size.intValue();
	    testVector.clear();
	    for (int i=0 ; i<len; i++) {
	      testVector.add(size);
	    }
	  }
	  
	  public void testSimpleList() {
	  }
	  
	  /**
	   * Test adding an element to a List
	   */
	  public void testSimpleList(@RangeField("baseRange") Integer size)
	  {
	    int len = size.intValue();
	    testList.clear();
	    for (int i=0 ; i<len; i++) {
	      testList.add(size);
	    }
	  }
	}
